package com.itheima.dubbo.web;

import com.itheima.dubbo.User;
import com.itheima.dubbo.UserFace;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("user")
public class UserController {

    @DubboReference //远程服务调用注解
    UserFace userFace;

    @GetMapping("hello")
    public String hello(String username){
        return userFace.hello(username);


    }

    @GetMapping("getById")
    public User getById(Long id){
        User user = new User();
        user.setId(id);
        return userFace.getById(user);


    }
}
